<?php
	/**
	 * The abstract TableEscrowGen class defined here is
	 * code-generated and contains all the basic CRUD-type functionality as well as
	 * basic methods to handle relationships and index-based loading.
	 *
	 * To use, you should use the TableEscrow subclass which
	 * extends this TableEscrowGen class.
	 *
	 * Because subsequent re-code generations will overwrite any changes to this
	 * file, you should leave this file unaltered to prevent yourself from losing
	 * any information or code changes.  All customizations should be done by
	 * overriding existing or implementing new methods, properties and variables
	 * in the TableEscrow class.
	 * 
	 * @package My Application
	 * @subpackage GeneratedDataObjects
	 * @property-read integer $Id the value for intId (Read-Only PK)
	 * @property integer $UserIdFrom the value for intUserIdFrom (Not Null)
	 * @property integer $UserIdTo the value for intUserIdTo (Not Null)
	 * @property integer $ProjectId the value for intProjectId (Not Null)
	 * @property integer $Amount the value for intAmount (Not Null)
	 * @property string $Reason the value for strReason (Not Null)
	 * @property QDateTime $EscrowDate the value for dttEscrowDate 
	 * @property QDateTime $CancelDate the value for dttCancelDate 
	 * @property QDateTime $PaidDate the value for dttPaidDate 
	 * @property integer $FeeForUserFrom the value for intFeeForUserFrom (Not Null)
	 * @property integer $FeeForUserTo the value for intFeeForUserTo (Not Null)
	 * @property integer $Status the value for intStatus (Not Null)
	 * @property string $SignForRelease the value for strSignForRelease 
	 * @property integer $TransactionId the value for intTransactionId (Not Null)
	 * @property integer $Type the value for intType (Not Null)
	 * @property TableUserProject $UserIdFromObject the value for the TableUserProject object referenced by intUserIdFrom (Not Null)
	 * @property TableUserProject $UserIdToObject the value for the TableUserProject object referenced by intUserIdTo (Not Null)
	 * @property TableProject $Project the value for the TableProject object referenced by intProjectId (Not Null)
	 * @property-read TableTransaction $_TableTransactionAsEscrow the value for the private _objTableTransactionAsEscrow (Read-Only) if set due to an expansion on the table_transaction.escrow_id reverse relationship
	 * @property-read TableTransaction[] $_TableTransactionAsEscrowArray the value for the private _objTableTransactionAsEscrowArray (Read-Only) if set due to an ExpandAsArray on the table_transaction.escrow_id reverse relationship
	 * @property-read boolean $__Restored whether or not this object was restored from the database (as opposed to created new)
	 */
	class TableEscrowGen extends QBaseClass {

		///////////////////////////////////////////////////////////////////////
		// PROTECTED MEMBER VARIABLES and TEXT FIELD MAXLENGTHS (if applicable)
		///////////////////////////////////////////////////////////////////////
		
		/**
		 * Protected member variable that maps to the database PK Identity column table_escrow.id
		 * @var integer intId
		 */
		protected $intId;
		const IdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_escrow.user_id_from
		 * @var integer intUserIdFrom
		 */
		protected $intUserIdFrom;
		const UserIdFromDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_escrow.user_id_to
		 * @var integer intUserIdTo
		 */
		protected $intUserIdTo;
		const UserIdToDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_escrow.project_id
		 * @var integer intProjectId
		 */
		protected $intProjectId;
		const ProjectIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_escrow.amount
		 * @var integer intAmount
		 */
		protected $intAmount;
		const AmountDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_escrow.reason
		 * @var string strReason
		 */
		protected $strReason;
		const ReasonMaxLength = 200;
		const ReasonDefault = null;


		/**
		 * Protected member variable that maps to the database column table_escrow.escrow_date
		 * @var QDateTime dttEscrowDate
		 */
		protected $dttEscrowDate;
		const EscrowDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_escrow.cancel_date
		 * @var QDateTime dttCancelDate
		 */
		protected $dttCancelDate;
		const CancelDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_escrow.paid_date
		 * @var QDateTime dttPaidDate
		 */
		protected $dttPaidDate;
		const PaidDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_escrow.fee_for_user_from
		 * @var integer intFeeForUserFrom
		 */
		protected $intFeeForUserFrom;
		const FeeForUserFromDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_escrow.fee_for_user_to
		 * @var integer intFeeForUserTo
		 */
		protected $intFeeForUserTo;
		const FeeForUserToDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_escrow.status
		 * @var integer intStatus
		 */
		protected $intStatus;
		const StatusDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_escrow.sign_for_release
		 * @var string strSignForRelease
		 */
		protected $strSignForRelease;
		const SignForReleaseMaxLength = 100;
		const SignForReleaseDefault = null;


		/**
		 * Protected member variable that maps to the database column table_escrow.transaction_id
		 * @var integer intTransactionId
		 */
		protected $intTransactionId;
		const TransactionIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_escrow.type
		 * @var integer intType
		 */
		protected $intType;
		const TypeDefault = 0;


		/**
		 * Private member variable that stores a reference to a single TableTransactionAsEscrow object
		 * (of type TableTransaction), if this TableEscrow object was restored with
		 * an expansion on the table_transaction association table.
		 * @var TableTransaction _objTableTransactionAsEscrow;
		 */
		private $_objTableTransactionAsEscrow;

		/**
		 * Private member variable that stores a reference to an array of TableTransactionAsEscrow objects
		 * (of type TableTransaction[]), if this TableEscrow object was restored with
		 * an ExpandAsArray on the table_transaction association table.
		 * @var TableTransaction[] _objTableTransactionAsEscrowArray;
		 */
		private $_objTableTransactionAsEscrowArray = array();

		/**
		 * Protected array of virtual attributes for this object (e.g. extra/other calculated and/or non-object bound
		 * columns from the run-time database query result for this object).  Used by InstantiateDbRow and
		 * GetVirtualAttribute.
		 * @var string[] $__strVirtualAttributeArray
		 */
		protected $__strVirtualAttributeArray = array();

		/**
		 * Protected internal member variable that specifies whether or not this object is Restored from the database.
		 * Used by Save() to determine if Save() should perform a db UPDATE or INSERT.
		 * @var bool __blnRestored;
		 */
		protected $__blnRestored;




		///////////////////////////////
		// PROTECTED MEMBER OBJECTS
		///////////////////////////////

		/**
		 * Protected member variable that contains the object pointed by the reference
		 * in the database column table_escrow.user_id_from.
		 *
		 * NOTE: Always use the UserIdFromObject property getter to correctly retrieve this TableUserProject object.
		 * (Because this class implements late binding, this variable reference MAY be null.)
		 * @var TableUserProject objUserIdFromObject
		 */
		protected $objUserIdFromObject;

		/**
		 * Protected member variable that contains the object pointed by the reference
		 * in the database column table_escrow.user_id_to.
		 *
		 * NOTE: Always use the UserIdToObject property getter to correctly retrieve this TableUserProject object.
		 * (Because this class implements late binding, this variable reference MAY be null.)
		 * @var TableUserProject objUserIdToObject
		 */
		protected $objUserIdToObject;

		/**
		 * Protected member variable that contains the object pointed by the reference
		 * in the database column table_escrow.project_id.
		 *
		 * NOTE: Always use the Project property getter to correctly retrieve this TableProject object.
		 * (Because this class implements late binding, this variable reference MAY be null.)
		 * @var TableProject objProject
		 */
		protected $objProject;





		///////////////////////////////
		// CLASS-WIDE LOAD AND COUNT METHODS
		///////////////////////////////

		/**
		 * Static method to retrieve the Database object that owns this class.
		 * @return QDatabaseBase reference to the Database object that can query this class
		 */
		public static function GetDatabase() {
			return QApplication::$Database[1];
		}

		/**
		 * Load a TableEscrow from PK Info
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableEscrow
		 */
		public static function Load($intId, $objOptionalClauses = null) {
			// Use QuerySingle to Perform the Query
			return TableEscrow::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TableEscrow()->Id, $intId)
				),
				$objOptionalClauses
			);
		}

		/**
		 * Load all TableEscrows
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableEscrow[]
		 */
		public static function LoadAll($objOptionalClauses = null) {
			if (func_num_args() > 1) {
				throw new QCallerException("LoadAll must be called with an array of optional clauses as a single argument");
			}
			// Call TableEscrow::QueryArray to perform the LoadAll query
			try {
				return TableEscrow::QueryArray(QQ::All(), $objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count all TableEscrows
		 * @return int
		 */
		public static function CountAll() {
			// Call TableEscrow::QueryCount to perform the CountAll query
			return TableEscrow::QueryCount(QQ::All());
		}




		///////////////////////////////
		// QCUBED QUERY-RELATED METHODS
		///////////////////////////////

		/**
		 * Internally called method to assist with calling Qcubed Query for this class
		 * on load methods.
		 * @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
		 * @param boolean $blnCountOnly only select a rowcount
		 * @return string the query statement
		 */
		protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly) {
			// Get the Database Object for this Class
			$objDatabase = TableEscrow::GetDatabase();

			// Create/Build out the QueryBuilder object with TableEscrow-specific SELET and FROM fields
			$objQueryBuilder = new QQueryBuilder($objDatabase, 'table_escrow');
			TableEscrow::GetSelectFields($objQueryBuilder);
			$objQueryBuilder->AddFromItem('table_escrow');

			// Set "CountOnly" option (if applicable)
			if ($blnCountOnly)
				$objQueryBuilder->SetCountOnlyFlag();

			// Apply Any Conditions
			if ($objConditions)
				try {
					$objConditions->UpdateQueryBuilder($objQueryBuilder);
				} catch (QCallerException $objExc) {
					$objExc->IncrementOffset();
					throw $objExc;
				}

			// Iterate through all the Optional Clauses (if any) and perform accordingly
			if ($objOptionalClauses) {
				if ($objOptionalClauses instanceof QQClause)
					$objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
				else if (is_array($objOptionalClauses))
					foreach ($objOptionalClauses as $objClause)
						$objClause->UpdateQueryBuilder($objQueryBuilder);
				else
					throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
			}

			// Get the SQL Statement
			$strQuery = $objQueryBuilder->GetStatement();

			// Prepare the Statement with the Query Parameters (if applicable)
			if ($mixParameterArray) {
				if (is_array($mixParameterArray)) {
					if (count($mixParameterArray))
						$strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);

					// Ensure that there are no other Unresolved Named Parameters
					if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false)
						throw new QCallerException('Unresolved named parameters in the query');
				} else
					throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
			}

			// Return the Objects
			return $strQuery;
		}

		/**
		 * Static Qcubed Query method to query for a single TableEscrow object.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return TableEscrow the queried object
		 */
		public static function QuerySingle(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableEscrow::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
			
			// Perform the Query, Get the First Row, and Instantiate a new TableEscrow object
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			
			// Do we have to expand anything?
			if ($objQueryBuilder->ExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = TableEscrow::InstantiateDbRow($objDbRow, null, $objQueryBuilder->ExpandAsArrayNodes, $objToReturn, $objQueryBuilder->ColumnAliasArray);
					if ($objItem)
						$objToReturn[] = $objItem;					
				}			
				// Since we only want the object to return, lets return the object and not the array.
				return $objToReturn[0];
			} else {
				// No expands just return the first row
				$objToReturn = null;
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn = TableEscrow::InstantiateDbRow($objDbRow, null, null, null, $objQueryBuilder->ColumnAliasArray);
			}
			
			return $objToReturn;
		}

		/**
		 * Static Qcubed Query method to query for an array of TableEscrow objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return TableEscrow[] the queried objects as an array
		 */
		public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableEscrow::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and Instantiate the Array Result
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			return TableEscrow::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
		}

		/**
		 * Static Qcubed Query method to query for a count of TableEscrow objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return integer the count of queried objects as an integer
		 */
		public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableEscrow::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and return the row_count
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);

			// Figure out if the query is using GroupBy
			$blnGrouped = false;

			if ($objOptionalClauses) foreach ($objOptionalClauses as $objClause) {
				if ($objClause instanceof QQGroupBy) {
					$blnGrouped = true;
					break;
				}
			}

			if ($blnGrouped)
				// Groups in this query - return the count of Groups (which is the count of all rows)
				return $objDbResult->CountRows();
			else {
				// No Groups - return the sql-calculated count(*) value
				$strDbRow = $objDbResult->FetchRow();
				return QType::Cast($strDbRow[0], QType::Integer);
			}
		}

		public static function QueryArrayCached(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = TableEscrow::GetDatabase();

			$strQuery = TableEscrow::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			
			$objCache = new QCache('qquery/tableescrow', $strQuery);
			$cacheData = $objCache->GetData();
			
			if (!$cacheData || $blnForceUpdate) {
				$objDbResult = $objQueryBuilder->Database->Query($strQuery);
				$arrResult = TableEscrow::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
				$objCache->SaveData(serialize($arrResult));
			} else {
				$arrResult = unserialize($cacheData);
			}
			
			return $arrResult;
		}

		/**
		 * Updates a QQueryBuilder with the SELECT fields for this TableEscrow
		 * @param QQueryBuilder $objBuilder the Query Builder object to update
		 * @param string $strPrefix optional prefix to add to the SELECT fields
		 */
		public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null) {
			if ($strPrefix) {
				$strTableName = $strPrefix;
				$strAliasPrefix = $strPrefix . '__';
			} else {
				$strTableName = 'table_escrow';
				$strAliasPrefix = '';
			}

			$objBuilder->AddSelectItem($strTableName, 'id', $strAliasPrefix . 'id');
			$objBuilder->AddSelectItem($strTableName, 'user_id_from', $strAliasPrefix . 'user_id_from');
			$objBuilder->AddSelectItem($strTableName, 'user_id_to', $strAliasPrefix . 'user_id_to');
			$objBuilder->AddSelectItem($strTableName, 'project_id', $strAliasPrefix . 'project_id');
			$objBuilder->AddSelectItem($strTableName, 'amount', $strAliasPrefix . 'amount');
			$objBuilder->AddSelectItem($strTableName, 'reason', $strAliasPrefix . 'reason');
			$objBuilder->AddSelectItem($strTableName, 'escrow_date', $strAliasPrefix . 'escrow_date');
			$objBuilder->AddSelectItem($strTableName, 'cancel_date', $strAliasPrefix . 'cancel_date');
			$objBuilder->AddSelectItem($strTableName, 'paid_date', $strAliasPrefix . 'paid_date');
			$objBuilder->AddSelectItem($strTableName, 'fee_for_user_from', $strAliasPrefix . 'fee_for_user_from');
			$objBuilder->AddSelectItem($strTableName, 'fee_for_user_to', $strAliasPrefix . 'fee_for_user_to');
			$objBuilder->AddSelectItem($strTableName, 'status', $strAliasPrefix . 'status');
			$objBuilder->AddSelectItem($strTableName, 'sign_for_release', $strAliasPrefix . 'sign_for_release');
			$objBuilder->AddSelectItem($strTableName, 'transaction_id', $strAliasPrefix . 'transaction_id');
			$objBuilder->AddSelectItem($strTableName, 'type', $strAliasPrefix . 'type');
		}



		///////////////////////////////
		// INSTANTIATION-RELATED METHODS
		///////////////////////////////

		/**
		 * Instantiate a TableEscrow from a Database Row.
		 * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
		 * is calling this TableEscrow::InstantiateDbRow in order to perform
		 * early binding on referenced objects.
		 * @param DatabaseRowBase $objDbRow
		 * @param string $strAliasPrefix
		 * @param string $strExpandAsArrayNodes
		 * @param QBaseClass $arrPreviousItem
		 * @param string[] $strColumnAliasArray
		 * @return TableEscrow
		*/
		public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $arrPreviousItems = null, $strColumnAliasArray = array()) {
			// If blank row, return null
			if (!$objDbRow) {
				return null;
			}
			// See if we're doing an array expansion on the previous item
			$strAlias = $strAliasPrefix . 'id';
			$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
			if (($strExpandAsArrayNodes) && is_array($arrPreviousItems) && count($arrPreviousItems)) {
				foreach ($arrPreviousItems as $objPreviousItem) {            
					if ($objPreviousItem->intId == $objDbRow->GetColumn($strAliasName, 'Integer')) {        
						// We are.  Now, prepare to check for ExpandAsArray clauses
						$blnExpandedViaArray = false;
						if (!$strAliasPrefix)
							$strAliasPrefix = 'table_escrow__';


						// Expanding reverse references: TableTransactionAsEscrow
						$strAlias = $strAliasPrefix . 'tabletransactionasescrow__id';
						$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
						if ((array_key_exists($strAlias, $strExpandAsArrayNodes)) &&
							(!is_null($objDbRow->GetColumn($strAliasName)))) {
							if ($intPreviousChildItemCount = count($objPreviousItem->_objTableTransactionAsEscrowArray)) {
								$objPreviousChildItems = $objPreviousItem->_objTableTransactionAsEscrowArray;
								$objChildItem = TableTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'tabletransactionasescrow__', $strExpandAsArrayNodes, $objPreviousChildItems, $strColumnAliasArray);
								if ($objChildItem) {
									$objPreviousItem->_objTableTransactionAsEscrowArray[] = $objChildItem;
								}
							} else {
								$objPreviousItem->_objTableTransactionAsEscrowArray[] = TableTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'tabletransactionasescrow__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
							}
							$blnExpandedViaArray = true;
						}

						// Either return false to signal array expansion, or check-to-reset the Alias prefix and move on
						if ($blnExpandedViaArray) {
							return false;
						} else if ($strAliasPrefix == 'table_escrow__') {
							$strAliasPrefix = null;
						}
					}
				}
			}

			// Create a new instance of the TableEscrow object
			$objToReturn = new TableEscrow();
			$objToReturn->__blnRestored = true;

			$strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id';
			$objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'user_id_from', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'user_id_from'] : $strAliasPrefix . 'user_id_from';
			$objToReturn->intUserIdFrom = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'user_id_to', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'user_id_to'] : $strAliasPrefix . 'user_id_to';
			$objToReturn->intUserIdTo = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'project_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'project_id'] : $strAliasPrefix . 'project_id';
			$objToReturn->intProjectId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'amount', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'amount'] : $strAliasPrefix . 'amount';
			$objToReturn->intAmount = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'reason', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'reason'] : $strAliasPrefix . 'reason';
			$objToReturn->strReason = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'escrow_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'escrow_date'] : $strAliasPrefix . 'escrow_date';
			$objToReturn->dttEscrowDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'cancel_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'cancel_date'] : $strAliasPrefix . 'cancel_date';
			$objToReturn->dttCancelDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'paid_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'paid_date'] : $strAliasPrefix . 'paid_date';
			$objToReturn->dttPaidDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'fee_for_user_from', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'fee_for_user_from'] : $strAliasPrefix . 'fee_for_user_from';
			$objToReturn->intFeeForUserFrom = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'fee_for_user_to', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'fee_for_user_to'] : $strAliasPrefix . 'fee_for_user_to';
			$objToReturn->intFeeForUserTo = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'status', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'status'] : $strAliasPrefix . 'status';
			$objToReturn->intStatus = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'sign_for_release', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'sign_for_release'] : $strAliasPrefix . 'sign_for_release';
			$objToReturn->strSignForRelease = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'transaction_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'transaction_id'] : $strAliasPrefix . 'transaction_id';
			$objToReturn->intTransactionId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'type', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'type'] : $strAliasPrefix . 'type';
			$objToReturn->intType = $objDbRow->GetColumn($strAliasName, 'Integer');

			if (isset($arrPreviousItems) && is_array($arrPreviousItems)) {
				foreach ($arrPreviousItems as $objPreviousItem) {
					if ($objToReturn->Id != $objPreviousItem->Id) {
						continue;
					}
					if (array_diff($objPreviousItem->_objTableTransactionAsEscrowArray, $objToReturn->_objTableTransactionAsEscrowArray) != null) {
						continue;
					}

					// complete match - all primary key columns are the same
					return null;
				}
			}

			// Instantiate Virtual Attributes
			foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
				$strVirtualPrefix = $strAliasPrefix . '__';
				$strVirtualPrefixLength = strlen($strVirtualPrefix);
				if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix)
					$objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
			}

			// Prepare to Check for Early/Virtual Binding
			if (!$strAliasPrefix)
				$strAliasPrefix = 'table_escrow__';

			// Check for UserIdFromObject Early Binding
			$strAlias = $strAliasPrefix . 'user_id_from__id';
			$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
			if (!is_null($objDbRow->GetColumn($strAliasName)))
				$objToReturn->objUserIdFromObject = TableUserProject::InstantiateDbRow($objDbRow, $strAliasPrefix . 'user_id_from__', $strExpandAsArrayNodes, null, $strColumnAliasArray);

			// Check for UserIdToObject Early Binding
			$strAlias = $strAliasPrefix . 'user_id_to__id';
			$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
			if (!is_null($objDbRow->GetColumn($strAliasName)))
				$objToReturn->objUserIdToObject = TableUserProject::InstantiateDbRow($objDbRow, $strAliasPrefix . 'user_id_to__', $strExpandAsArrayNodes, null, $strColumnAliasArray);

			// Check for Project Early Binding
			$strAlias = $strAliasPrefix . 'project_id__id';
			$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
			if (!is_null($objDbRow->GetColumn($strAliasName)))
				$objToReturn->objProject = TableProject::InstantiateDbRow($objDbRow, $strAliasPrefix . 'project_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);




			// Check for TableTransactionAsEscrow Virtual Binding
			$strAlias = $strAliasPrefix . 'tabletransactionasescrow__id';
			$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
			if (!is_null($objDbRow->GetColumn($strAliasName))) {
				if (($strExpandAsArrayNodes) && (array_key_exists($strAlias, $strExpandAsArrayNodes)))
					$objToReturn->_objTableTransactionAsEscrowArray[] = TableTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'tabletransactionasescrow__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
				else
					$objToReturn->_objTableTransactionAsEscrow = TableTransaction::InstantiateDbRow($objDbRow, $strAliasPrefix . 'tabletransactionasescrow__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
			}

			return $objToReturn;
		}

		/**
		 * Instantiate an array of TableEscrows from a Database Result
		 * @param DatabaseResultBase $objDbResult
		 * @param string $strExpandAsArrayNodes
		 * @param string[] $strColumnAliasArray
		 * @return TableEscrow[]
		 */
		public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null) {
			$objToReturn = array();
			
			if (!$strColumnAliasArray)
				$strColumnAliasArray = array();

			// If blank resultset, then return empty array
			if (!$objDbResult)
				return $objToReturn;

			// Load up the return array with each row
			if ($strExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = TableEscrow::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objToReturn, $strColumnAliasArray);
					if ($objItem) {
						$objToReturn[] = $objItem;
					}
				}
			} else {
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn[] = TableEscrow::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray);
			}

			return $objToReturn;
		}



		///////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Single Load and Array)
		///////////////////////////////////////////////////
			
		/**
		 * Load a single TableEscrow object,
		 * by Id Index(es)
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableEscrow
		*/
		public static function LoadById($intId, $objOptionalClauses = null) {
			return TableEscrow::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TableEscrow()->Id, $intId)
				),
				$objOptionalClauses
			);
		}
			
		/**
		 * Load an array of TableEscrow objects,
		 * by UserIdFrom Index(es)
		 * @param integer $intUserIdFrom
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableEscrow[]
		*/
		public static function LoadArrayByUserIdFrom($intUserIdFrom, $objOptionalClauses = null) {
			// Call TableEscrow::QueryArray to perform the LoadArrayByUserIdFrom query
			try {
				return TableEscrow::QueryArray(
					QQ::Equal(QQN::TableEscrow()->UserIdFrom, $intUserIdFrom),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableEscrows
		 * by UserIdFrom Index(es)
		 * @param integer $intUserIdFrom
		 * @return int
		*/
		public static function CountByUserIdFrom($intUserIdFrom) {
			// Call TableEscrow::QueryCount to perform the CountByUserIdFrom query
			return TableEscrow::QueryCount(
				QQ::Equal(QQN::TableEscrow()->UserIdFrom, $intUserIdFrom)
			);
		}
			
		/**
		 * Load an array of TableEscrow objects,
		 * by UserIdTo Index(es)
		 * @param integer $intUserIdTo
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableEscrow[]
		*/
		public static function LoadArrayByUserIdTo($intUserIdTo, $objOptionalClauses = null) {
			// Call TableEscrow::QueryArray to perform the LoadArrayByUserIdTo query
			try {
				return TableEscrow::QueryArray(
					QQ::Equal(QQN::TableEscrow()->UserIdTo, $intUserIdTo),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableEscrows
		 * by UserIdTo Index(es)
		 * @param integer $intUserIdTo
		 * @return int
		*/
		public static function CountByUserIdTo($intUserIdTo) {
			// Call TableEscrow::QueryCount to perform the CountByUserIdTo query
			return TableEscrow::QueryCount(
				QQ::Equal(QQN::TableEscrow()->UserIdTo, $intUserIdTo)
			);
		}
			
		/**
		 * Load an array of TableEscrow objects,
		 * by ProjectId Index(es)
		 * @param integer $intProjectId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableEscrow[]
		*/
		public static function LoadArrayByProjectId($intProjectId, $objOptionalClauses = null) {
			// Call TableEscrow::QueryArray to perform the LoadArrayByProjectId query
			try {
				return TableEscrow::QueryArray(
					QQ::Equal(QQN::TableEscrow()->ProjectId, $intProjectId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableEscrows
		 * by ProjectId Index(es)
		 * @param integer $intProjectId
		 * @return int
		*/
		public static function CountByProjectId($intProjectId) {
			// Call TableEscrow::QueryCount to perform the CountByProjectId query
			return TableEscrow::QueryCount(
				QQ::Equal(QQN::TableEscrow()->ProjectId, $intProjectId)
			);
		}
			
		/**
		 * Load an array of TableEscrow objects,
		 * by Amount Index(es)
		 * @param integer $intAmount
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableEscrow[]
		*/
		public static function LoadArrayByAmount($intAmount, $objOptionalClauses = null) {
			// Call TableEscrow::QueryArray to perform the LoadArrayByAmount query
			try {
				return TableEscrow::QueryArray(
					QQ::Equal(QQN::TableEscrow()->Amount, $intAmount),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableEscrows
		 * by Amount Index(es)
		 * @param integer $intAmount
		 * @return int
		*/
		public static function CountByAmount($intAmount) {
			// Call TableEscrow::QueryCount to perform the CountByAmount query
			return TableEscrow::QueryCount(
				QQ::Equal(QQN::TableEscrow()->Amount, $intAmount)
			);
		}
			
		/**
		 * Load an array of TableEscrow objects,
		 * by EscrowDate Index(es)
		 * @param QDateTime $dttEscrowDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableEscrow[]
		*/
		public static function LoadArrayByEscrowDate($dttEscrowDate, $objOptionalClauses = null) {
			// Call TableEscrow::QueryArray to perform the LoadArrayByEscrowDate query
			try {
				return TableEscrow::QueryArray(
					QQ::Equal(QQN::TableEscrow()->EscrowDate, $dttEscrowDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableEscrows
		 * by EscrowDate Index(es)
		 * @param QDateTime $dttEscrowDate
		 * @return int
		*/
		public static function CountByEscrowDate($dttEscrowDate) {
			// Call TableEscrow::QueryCount to perform the CountByEscrowDate query
			return TableEscrow::QueryCount(
				QQ::Equal(QQN::TableEscrow()->EscrowDate, $dttEscrowDate)
			);
		}
			
		/**
		 * Load an array of TableEscrow objects,
		 * by CancelDate Index(es)
		 * @param QDateTime $dttCancelDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableEscrow[]
		*/
		public static function LoadArrayByCancelDate($dttCancelDate, $objOptionalClauses = null) {
			// Call TableEscrow::QueryArray to perform the LoadArrayByCancelDate query
			try {
				return TableEscrow::QueryArray(
					QQ::Equal(QQN::TableEscrow()->CancelDate, $dttCancelDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableEscrows
		 * by CancelDate Index(es)
		 * @param QDateTime $dttCancelDate
		 * @return int
		*/
		public static function CountByCancelDate($dttCancelDate) {
			// Call TableEscrow::QueryCount to perform the CountByCancelDate query
			return TableEscrow::QueryCount(
				QQ::Equal(QQN::TableEscrow()->CancelDate, $dttCancelDate)
			);
		}
			
		/**
		 * Load an array of TableEscrow objects,
		 * by PaidDate Index(es)
		 * @param QDateTime $dttPaidDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableEscrow[]
		*/
		public static function LoadArrayByPaidDate($dttPaidDate, $objOptionalClauses = null) {
			// Call TableEscrow::QueryArray to perform the LoadArrayByPaidDate query
			try {
				return TableEscrow::QueryArray(
					QQ::Equal(QQN::TableEscrow()->PaidDate, $dttPaidDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableEscrows
		 * by PaidDate Index(es)
		 * @param QDateTime $dttPaidDate
		 * @return int
		*/
		public static function CountByPaidDate($dttPaidDate) {
			// Call TableEscrow::QueryCount to perform the CountByPaidDate query
			return TableEscrow::QueryCount(
				QQ::Equal(QQN::TableEscrow()->PaidDate, $dttPaidDate)
			);
		}
			
		/**
		 * Load an array of TableEscrow objects,
		 * by FeeForUserFrom Index(es)
		 * @param integer $intFeeForUserFrom
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableEscrow[]
		*/
		public static function LoadArrayByFeeForUserFrom($intFeeForUserFrom, $objOptionalClauses = null) {
			// Call TableEscrow::QueryArray to perform the LoadArrayByFeeForUserFrom query
			try {
				return TableEscrow::QueryArray(
					QQ::Equal(QQN::TableEscrow()->FeeForUserFrom, $intFeeForUserFrom),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableEscrows
		 * by FeeForUserFrom Index(es)
		 * @param integer $intFeeForUserFrom
		 * @return int
		*/
		public static function CountByFeeForUserFrom($intFeeForUserFrom) {
			// Call TableEscrow::QueryCount to perform the CountByFeeForUserFrom query
			return TableEscrow::QueryCount(
				QQ::Equal(QQN::TableEscrow()->FeeForUserFrom, $intFeeForUserFrom)
			);
		}
			
		/**
		 * Load an array of TableEscrow objects,
		 * by FeeForUserTo Index(es)
		 * @param integer $intFeeForUserTo
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableEscrow[]
		*/
		public static function LoadArrayByFeeForUserTo($intFeeForUserTo, $objOptionalClauses = null) {
			// Call TableEscrow::QueryArray to perform the LoadArrayByFeeForUserTo query
			try {
				return TableEscrow::QueryArray(
					QQ::Equal(QQN::TableEscrow()->FeeForUserTo, $intFeeForUserTo),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableEscrows
		 * by FeeForUserTo Index(es)
		 * @param integer $intFeeForUserTo
		 * @return int
		*/
		public static function CountByFeeForUserTo($intFeeForUserTo) {
			// Call TableEscrow::QueryCount to perform the CountByFeeForUserTo query
			return TableEscrow::QueryCount(
				QQ::Equal(QQN::TableEscrow()->FeeForUserTo, $intFeeForUserTo)
			);
		}
			
		/**
		 * Load an array of TableEscrow objects,
		 * by Status Index(es)
		 * @param integer $intStatus
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableEscrow[]
		*/
		public static function LoadArrayByStatus($intStatus, $objOptionalClauses = null) {
			// Call TableEscrow::QueryArray to perform the LoadArrayByStatus query
			try {
				return TableEscrow::QueryArray(
					QQ::Equal(QQN::TableEscrow()->Status, $intStatus),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableEscrows
		 * by Status Index(es)
		 * @param integer $intStatus
		 * @return int
		*/
		public static function CountByStatus($intStatus) {
			// Call TableEscrow::QueryCount to perform the CountByStatus query
			return TableEscrow::QueryCount(
				QQ::Equal(QQN::TableEscrow()->Status, $intStatus)
			);
		}



		////////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Array via Many to Many)
		////////////////////////////////////////////////////




		//////////////////////////
		// SAVE, DELETE AND RELOAD
		//////////////////////////

		/**
		 * Save this TableEscrow
		 * @param bool $blnForceInsert
		 * @param bool $blnForceUpdate
		 * @return int
		 */
		public function Save($blnForceInsert = false, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = TableEscrow::GetDatabase();

			$mixToReturn = null;

			try {
				if ((!$this->__blnRestored) || ($blnForceInsert)) {
					// Perform an INSERT query
					$objDatabase->NonQuery('
						INSERT INTO `table_escrow` (
							`user_id_from`,
							`user_id_to`,
							`project_id`,
							`amount`,
							`reason`,
							`escrow_date`,
							`cancel_date`,
							`paid_date`,
							`fee_for_user_from`,
							`fee_for_user_to`,
							`status`,
							`sign_for_release`,
							`transaction_id`,
							`type`
						) VALUES (
							' . $objDatabase->SqlVariable($this->intUserIdFrom) . ',
							' . $objDatabase->SqlVariable($this->intUserIdTo) . ',
							' . $objDatabase->SqlVariable($this->intProjectId) . ',
							' . $objDatabase->SqlVariable($this->intAmount) . ',
							' . $objDatabase->SqlVariable($this->strReason) . ',
							' . $objDatabase->SqlVariable($this->dttEscrowDate) . ',
							' . $objDatabase->SqlVariable($this->dttCancelDate) . ',
							' . $objDatabase->SqlVariable($this->dttPaidDate) . ',
							' . $objDatabase->SqlVariable($this->intFeeForUserFrom) . ',
							' . $objDatabase->SqlVariable($this->intFeeForUserTo) . ',
							' . $objDatabase->SqlVariable($this->intStatus) . ',
							' . $objDatabase->SqlVariable($this->strSignForRelease) . ',
							' . $objDatabase->SqlVariable($this->intTransactionId) . ',
							' . $objDatabase->SqlVariable($this->intType) . '
						)
					');

					// Update Identity column and return its value
					$mixToReturn = $this->intId = $objDatabase->InsertId('table_escrow', 'id');
				} else {
					// Perform an UPDATE query

					// First checking for Optimistic Locking constraints (if applicable)

					// Perform the UPDATE query
					$objDatabase->NonQuery('
						UPDATE
							`table_escrow`
						SET
							`user_id_from` = ' . $objDatabase->SqlVariable($this->intUserIdFrom) . ',
							`user_id_to` = ' . $objDatabase->SqlVariable($this->intUserIdTo) . ',
							`project_id` = ' . $objDatabase->SqlVariable($this->intProjectId) . ',
							`amount` = ' . $objDatabase->SqlVariable($this->intAmount) . ',
							`reason` = ' . $objDatabase->SqlVariable($this->strReason) . ',
							`escrow_date` = ' . $objDatabase->SqlVariable($this->dttEscrowDate) . ',
							`cancel_date` = ' . $objDatabase->SqlVariable($this->dttCancelDate) . ',
							`paid_date` = ' . $objDatabase->SqlVariable($this->dttPaidDate) . ',
							`fee_for_user_from` = ' . $objDatabase->SqlVariable($this->intFeeForUserFrom) . ',
							`fee_for_user_to` = ' . $objDatabase->SqlVariable($this->intFeeForUserTo) . ',
							`status` = ' . $objDatabase->SqlVariable($this->intStatus) . ',
							`sign_for_release` = ' . $objDatabase->SqlVariable($this->strSignForRelease) . ',
							`transaction_id` = ' . $objDatabase->SqlVariable($this->intTransactionId) . ',
							`type` = ' . $objDatabase->SqlVariable($this->intType) . '
						WHERE
							`id` = ' . $objDatabase->SqlVariable($this->intId) . '
					');
				}

			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Update __blnRestored and any Non-Identity PK Columns (if applicable)
			$this->__blnRestored = true;


			// Return 
			return $mixToReturn;
		}

		/**
		 * Delete this TableEscrow
		 * @return void
		 */
		public function Delete() {
			if ((is_null($this->intId)))
				throw new QUndefinedPrimaryKeyException('Cannot delete this TableEscrow with an unset primary key.');

			// Get the Database Object for this Class
			$objDatabase = TableEscrow::GetDatabase();


			// Perform the SQL Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_escrow`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($this->intId) . '');
		}

		/**
		 * Delete all TableEscrows
		 * @return void
		 */
		public static function DeleteAll() {
			// Get the Database Object for this Class
			$objDatabase = TableEscrow::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_escrow`');
		}

		/**
		 * Truncate table_escrow table
		 * @return void
		 */
		public static function Truncate() {
			// Get the Database Object for this Class
			$objDatabase = TableEscrow::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				TRUNCATE `table_escrow`');
		}

		/**
		 * Reload this TableEscrow from the database.
		 * @return void
		 */
		public function Reload() {
			// Make sure we are actually Restored from the database
			if (!$this->__blnRestored)
				throw new QCallerException('Cannot call Reload() on a new, unsaved TableEscrow object.');

			// Reload the Object
			$objReloaded = TableEscrow::Load($this->intId);

			// Update $this's local variables to match
			$this->UserIdFrom = $objReloaded->UserIdFrom;
			$this->UserIdTo = $objReloaded->UserIdTo;
			$this->ProjectId = $objReloaded->ProjectId;
			$this->intAmount = $objReloaded->intAmount;
			$this->strReason = $objReloaded->strReason;
			$this->dttEscrowDate = $objReloaded->dttEscrowDate;
			$this->dttCancelDate = $objReloaded->dttCancelDate;
			$this->dttPaidDate = $objReloaded->dttPaidDate;
			$this->intFeeForUserFrom = $objReloaded->intFeeForUserFrom;
			$this->intFeeForUserTo = $objReloaded->intFeeForUserTo;
			$this->intStatus = $objReloaded->intStatus;
			$this->strSignForRelease = $objReloaded->strSignForRelease;
			$this->intTransactionId = $objReloaded->intTransactionId;
			$this->intType = $objReloaded->intType;
		}



		////////////////////
		// PUBLIC OVERRIDERS
		////////////////////

				/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'Id':
					/**
					 * Gets the value for intId (Read-Only PK)
					 * @return integer
					 */
					return $this->intId;

				case 'UserIdFrom':
					/**
					 * Gets the value for intUserIdFrom (Not Null)
					 * @return integer
					 */
					return $this->intUserIdFrom;

				case 'UserIdTo':
					/**
					 * Gets the value for intUserIdTo (Not Null)
					 * @return integer
					 */
					return $this->intUserIdTo;

				case 'ProjectId':
					/**
					 * Gets the value for intProjectId (Not Null)
					 * @return integer
					 */
					return $this->intProjectId;

				case 'Amount':
					/**
					 * Gets the value for intAmount (Not Null)
					 * @return integer
					 */
					return $this->intAmount;

				case 'Reason':
					/**
					 * Gets the value for strReason (Not Null)
					 * @return string
					 */
					return $this->strReason;

				case 'EscrowDate':
					/**
					 * Gets the value for dttEscrowDate 
					 * @return QDateTime
					 */
					return $this->dttEscrowDate;

				case 'CancelDate':
					/**
					 * Gets the value for dttCancelDate 
					 * @return QDateTime
					 */
					return $this->dttCancelDate;

				case 'PaidDate':
					/**
					 * Gets the value for dttPaidDate 
					 * @return QDateTime
					 */
					return $this->dttPaidDate;

				case 'FeeForUserFrom':
					/**
					 * Gets the value for intFeeForUserFrom (Not Null)
					 * @return integer
					 */
					return $this->intFeeForUserFrom;

				case 'FeeForUserTo':
					/**
					 * Gets the value for intFeeForUserTo (Not Null)
					 * @return integer
					 */
					return $this->intFeeForUserTo;

				case 'Status':
					/**
					 * Gets the value for intStatus (Not Null)
					 * @return integer
					 */
					return $this->intStatus;

				case 'SignForRelease':
					/**
					 * Gets the value for strSignForRelease 
					 * @return string
					 */
					return $this->strSignForRelease;

				case 'TransactionId':
					/**
					 * Gets the value for intTransactionId (Not Null)
					 * @return integer
					 */
					return $this->intTransactionId;

				case 'Type':
					/**
					 * Gets the value for intType (Not Null)
					 * @return integer
					 */
					return $this->intType;


				///////////////////
				// Member Objects
				///////////////////
				case 'UserIdFromObject':
					/**
					 * Gets the value for the TableUserProject object referenced by intUserIdFrom (Not Null)
					 * @return TableUserProject
					 */
					try {
						if ((!$this->objUserIdFromObject) && (!is_null($this->intUserIdFrom)))
							$this->objUserIdFromObject = TableUserProject::Load($this->intUserIdFrom);
						return $this->objUserIdFromObject;
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'UserIdToObject':
					/**
					 * Gets the value for the TableUserProject object referenced by intUserIdTo (Not Null)
					 * @return TableUserProject
					 */
					try {
						if ((!$this->objUserIdToObject) && (!is_null($this->intUserIdTo)))
							$this->objUserIdToObject = TableUserProject::Load($this->intUserIdTo);
						return $this->objUserIdToObject;
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Project':
					/**
					 * Gets the value for the TableProject object referenced by intProjectId (Not Null)
					 * @return TableProject
					 */
					try {
						if ((!$this->objProject) && (!is_null($this->intProjectId)))
							$this->objProject = TableProject::Load($this->intProjectId);
						return $this->objProject;
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				////////////////////////////
				// Virtual Object References (Many to Many and Reverse References)
				// (If restored via a "Many-to" expansion)
				////////////////////////////

				case '_TableTransactionAsEscrow':
					/**
					 * Gets the value for the private _objTableTransactionAsEscrow (Read-Only)
					 * if set due to an expansion on the table_transaction.escrow_id reverse relationship
					 * @return TableTransaction
					 */
					return $this->_objTableTransactionAsEscrow;

				case '_TableTransactionAsEscrowArray':
					/**
					 * Gets the value for the private _objTableTransactionAsEscrowArray (Read-Only)
					 * if set due to an ExpandAsArray on the table_transaction.escrow_id reverse relationship
					 * @return TableTransaction[]
					 */
					return (array) $this->_objTableTransactionAsEscrowArray;


				case '__Restored':
					return $this->__blnRestored;

				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

				/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'UserIdFrom':
					/**
					 * Sets the value for intUserIdFrom (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						$this->objUserIdFromObject = null;
						return ($this->intUserIdFrom = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'UserIdTo':
					/**
					 * Sets the value for intUserIdTo (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						$this->objUserIdToObject = null;
						return ($this->intUserIdTo = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'ProjectId':
					/**
					 * Sets the value for intProjectId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						$this->objProject = null;
						return ($this->intProjectId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Amount':
					/**
					 * Sets the value for intAmount (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intAmount = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Reason':
					/**
					 * Sets the value for strReason (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strReason = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'EscrowDate':
					/**
					 * Sets the value for dttEscrowDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttEscrowDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'CancelDate':
					/**
					 * Sets the value for dttCancelDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttCancelDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'PaidDate':
					/**
					 * Sets the value for dttPaidDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttPaidDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'FeeForUserFrom':
					/**
					 * Sets the value for intFeeForUserFrom (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intFeeForUserFrom = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'FeeForUserTo':
					/**
					 * Sets the value for intFeeForUserTo (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intFeeForUserTo = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Status':
					/**
					 * Sets the value for intStatus (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intStatus = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'SignForRelease':
					/**
					 * Sets the value for strSignForRelease 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strSignForRelease = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'TransactionId':
					/**
					 * Sets the value for intTransactionId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intTransactionId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Type':
					/**
					 * Sets the value for intType (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intType = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				///////////////////
				// Member Objects
				///////////////////
				case 'UserIdFromObject':
					/**
					 * Sets the value for the TableUserProject object referenced by intUserIdFrom (Not Null)
					 * @param TableUserProject $mixValue
					 * @return TableUserProject
					 */
					if (is_null($mixValue)) {
						$this->intUserIdFrom = null;
						$this->objUserIdFromObject = null;
						return null;
					} else {
						// Make sure $mixValue actually is a TableUserProject object
						try {
							$mixValue = QType::Cast($mixValue, 'TableUserProject');
						} catch (QInvalidCastException $objExc) {
							$objExc->IncrementOffset();
							throw $objExc;
						} 

						// Make sure $mixValue is a SAVED TableUserProject object
						if (is_null($mixValue->Id))
							throw new QCallerException('Unable to set an unsaved UserIdFromObject for this TableEscrow');

						// Update Local Member Variables
						$this->objUserIdFromObject = $mixValue;
						$this->intUserIdFrom = $mixValue->Id;

						// Return $mixValue
						return $mixValue;
					}
					break;

				case 'UserIdToObject':
					/**
					 * Sets the value for the TableUserProject object referenced by intUserIdTo (Not Null)
					 * @param TableUserProject $mixValue
					 * @return TableUserProject
					 */
					if (is_null($mixValue)) {
						$this->intUserIdTo = null;
						$this->objUserIdToObject = null;
						return null;
					} else {
						// Make sure $mixValue actually is a TableUserProject object
						try {
							$mixValue = QType::Cast($mixValue, 'TableUserProject');
						} catch (QInvalidCastException $objExc) {
							$objExc->IncrementOffset();
							throw $objExc;
						} 

						// Make sure $mixValue is a SAVED TableUserProject object
						if (is_null($mixValue->Id))
							throw new QCallerException('Unable to set an unsaved UserIdToObject for this TableEscrow');

						// Update Local Member Variables
						$this->objUserIdToObject = $mixValue;
						$this->intUserIdTo = $mixValue->Id;

						// Return $mixValue
						return $mixValue;
					}
					break;

				case 'Project':
					/**
					 * Sets the value for the TableProject object referenced by intProjectId (Not Null)
					 * @param TableProject $mixValue
					 * @return TableProject
					 */
					if (is_null($mixValue)) {
						$this->intProjectId = null;
						$this->objProject = null;
						return null;
					} else {
						// Make sure $mixValue actually is a TableProject object
						try {
							$mixValue = QType::Cast($mixValue, 'TableProject');
						} catch (QInvalidCastException $objExc) {
							$objExc->IncrementOffset();
							throw $objExc;
						} 

						// Make sure $mixValue is a SAVED TableProject object
						if (is_null($mixValue->Id))
							throw new QCallerException('Unable to set an unsaved Project for this TableEscrow');

						// Update Local Member Variables
						$this->objProject = $mixValue;
						$this->intProjectId = $mixValue->Id;

						// Return $mixValue
						return $mixValue;
					}
					break;

				default:
					try {
						return parent::__set($strName, $mixValue);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Lookup a VirtualAttribute value (if applicable).  Returns NULL if none found.
		 * @param string $strName
		 * @return string
		 */
		public function GetVirtualAttribute($strName) {
			if (array_key_exists($strName, $this->__strVirtualAttributeArray))
				return $this->__strVirtualAttributeArray[$strName];
			return null;
		}



		///////////////////////////////
		// ASSOCIATED OBJECTS' METHODS
		///////////////////////////////

			
		
		// Related Objects' Methods for TableTransactionAsEscrow
		//-------------------------------------------------------------------

		/**
		 * Gets all associated TableTransactionsAsEscrow as an array of TableTransaction objects
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableTransaction[]
		*/ 
		public function GetTableTransactionAsEscrowArray($objOptionalClauses = null) {
			if ((is_null($this->intId)))
				return array();

			try {
				return TableTransaction::LoadArrayByEscrowId($this->intId, $objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Counts all associated TableTransactionsAsEscrow
		 * @return int
		*/ 
		public function CountTableTransactionsAsEscrow() {
			if ((is_null($this->intId)))
				return 0;

			return TableTransaction::CountByEscrowId($this->intId);
		}

		/**
		 * Associates a TableTransactionAsEscrow
		 * @param TableTransaction $objTableTransaction
		 * @return void
		*/ 
		public function AssociateTableTransactionAsEscrow(TableTransaction $objTableTransaction) {
			if ((is_null($this->intId)))
				throw new QUndefinedPrimaryKeyException('Unable to call AssociateTableTransactionAsEscrow on this unsaved TableEscrow.');
			if ((is_null($objTableTransaction->Id)))
				throw new QUndefinedPrimaryKeyException('Unable to call AssociateTableTransactionAsEscrow on this TableEscrow with an unsaved TableTransaction.');

			// Get the Database Object for this Class
			$objDatabase = TableEscrow::GetDatabase();

			// Perform the SQL Query
			$objDatabase->NonQuery('
				UPDATE
					`table_transaction`
				SET
					`escrow_id` = ' . $objDatabase->SqlVariable($this->intId) . '
				WHERE
					`id` = ' . $objDatabase->SqlVariable($objTableTransaction->Id) . '
			');
		}

		/**
		 * Unassociates a TableTransactionAsEscrow
		 * @param TableTransaction $objTableTransaction
		 * @return void
		*/ 
		public function UnassociateTableTransactionAsEscrow(TableTransaction $objTableTransaction) {
			if ((is_null($this->intId)))
				throw new QUndefinedPrimaryKeyException('Unable to call UnassociateTableTransactionAsEscrow on this unsaved TableEscrow.');
			if ((is_null($objTableTransaction->Id)))
				throw new QUndefinedPrimaryKeyException('Unable to call UnassociateTableTransactionAsEscrow on this TableEscrow with an unsaved TableTransaction.');

			// Get the Database Object for this Class
			$objDatabase = TableEscrow::GetDatabase();

			// Perform the SQL Query
			$objDatabase->NonQuery('
				UPDATE
					`table_transaction`
				SET
					`escrow_id` = null
				WHERE
					`id` = ' . $objDatabase->SqlVariable($objTableTransaction->Id) . ' AND
					`escrow_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
		}

		/**
		 * Unassociates all TableTransactionsAsEscrow
		 * @return void
		*/ 
		public function UnassociateAllTableTransactionsAsEscrow() {
			if ((is_null($this->intId)))
				throw new QUndefinedPrimaryKeyException('Unable to call UnassociateTableTransactionAsEscrow on this unsaved TableEscrow.');

			// Get the Database Object for this Class
			$objDatabase = TableEscrow::GetDatabase();

			// Perform the SQL Query
			$objDatabase->NonQuery('
				UPDATE
					`table_transaction`
				SET
					`escrow_id` = null
				WHERE
					`escrow_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
		}

		/**
		 * Deletes an associated TableTransactionAsEscrow
		 * @param TableTransaction $objTableTransaction
		 * @return void
		*/ 
		public function DeleteAssociatedTableTransactionAsEscrow(TableTransaction $objTableTransaction) {
			if ((is_null($this->intId)))
				throw new QUndefinedPrimaryKeyException('Unable to call UnassociateTableTransactionAsEscrow on this unsaved TableEscrow.');
			if ((is_null($objTableTransaction->Id)))
				throw new QUndefinedPrimaryKeyException('Unable to call UnassociateTableTransactionAsEscrow on this TableEscrow with an unsaved TableTransaction.');

			// Get the Database Object for this Class
			$objDatabase = TableEscrow::GetDatabase();

			// Perform the SQL Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_transaction`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($objTableTransaction->Id) . ' AND
					`escrow_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
		}

		/**
		 * Deletes all associated TableTransactionsAsEscrow
		 * @return void
		*/ 
		public function DeleteAllTableTransactionsAsEscrow() {
			if ((is_null($this->intId)))
				throw new QUndefinedPrimaryKeyException('Unable to call UnassociateTableTransactionAsEscrow on this unsaved TableEscrow.');

			// Get the Database Object for this Class
			$objDatabase = TableEscrow::GetDatabase();

			// Perform the SQL Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_transaction`
				WHERE
					`escrow_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
		}





		////////////////////////////////////////
		// METHODS for SOAP-BASED WEB SERVICES
		////////////////////////////////////////

		public static function GetSoapComplexTypeXml() {
			$strToReturn = '<complexType name="TableEscrow"><sequence>';
			$strToReturn .= '<element name="Id" type="xsd:int"/>';
			$strToReturn .= '<element name="UserIdFromObject" type="xsd1:TableUserProject"/>';
			$strToReturn .= '<element name="UserIdToObject" type="xsd1:TableUserProject"/>';
			$strToReturn .= '<element name="Project" type="xsd1:TableProject"/>';
			$strToReturn .= '<element name="Amount" type="xsd:int"/>';
			$strToReturn .= '<element name="Reason" type="xsd:string"/>';
			$strToReturn .= '<element name="EscrowDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="CancelDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="PaidDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="FeeForUserFrom" type="xsd:int"/>';
			$strToReturn .= '<element name="FeeForUserTo" type="xsd:int"/>';
			$strToReturn .= '<element name="Status" type="xsd:int"/>';
			$strToReturn .= '<element name="SignForRelease" type="xsd:string"/>';
			$strToReturn .= '<element name="TransactionId" type="xsd:int"/>';
			$strToReturn .= '<element name="Type" type="xsd:int"/>';
			$strToReturn .= '<element name="__blnRestored" type="xsd:boolean"/>';
			$strToReturn .= '</sequence></complexType>';
			return $strToReturn;
		}

		public static function AlterSoapComplexTypeArray(&$strComplexTypeArray) {
			if (!array_key_exists('TableEscrow', $strComplexTypeArray)) {
				$strComplexTypeArray['TableEscrow'] = TableEscrow::GetSoapComplexTypeXml();
				TableUserProject::AlterSoapComplexTypeArray($strComplexTypeArray);
				TableUserProject::AlterSoapComplexTypeArray($strComplexTypeArray);
				TableProject::AlterSoapComplexTypeArray($strComplexTypeArray);
			}
		}

		public static function GetArrayFromSoapArray($objSoapArray) {
			$objArrayToReturn = array();

			foreach ($objSoapArray as $objSoapObject)
				array_push($objArrayToReturn, TableEscrow::GetObjectFromSoapObject($objSoapObject));

			return $objArrayToReturn;
		}

		public static function GetObjectFromSoapObject($objSoapObject) {
			$objToReturn = new TableEscrow();
			if (property_exists($objSoapObject, 'Id'))
				$objToReturn->intId = $objSoapObject->Id;
			if ((property_exists($objSoapObject, 'UserIdFromObject')) &&
				($objSoapObject->UserIdFromObject))
				$objToReturn->UserIdFromObject = TableUserProject::GetObjectFromSoapObject($objSoapObject->UserIdFromObject);
			if ((property_exists($objSoapObject, 'UserIdToObject')) &&
				($objSoapObject->UserIdToObject))
				$objToReturn->UserIdToObject = TableUserProject::GetObjectFromSoapObject($objSoapObject->UserIdToObject);
			if ((property_exists($objSoapObject, 'Project')) &&
				($objSoapObject->Project))
				$objToReturn->Project = TableProject::GetObjectFromSoapObject($objSoapObject->Project);
			if (property_exists($objSoapObject, 'Amount'))
				$objToReturn->intAmount = $objSoapObject->Amount;
			if (property_exists($objSoapObject, 'Reason'))
				$objToReturn->strReason = $objSoapObject->Reason;
			if (property_exists($objSoapObject, 'EscrowDate'))
				$objToReturn->dttEscrowDate = new QDateTime($objSoapObject->EscrowDate);
			if (property_exists($objSoapObject, 'CancelDate'))
				$objToReturn->dttCancelDate = new QDateTime($objSoapObject->CancelDate);
			if (property_exists($objSoapObject, 'PaidDate'))
				$objToReturn->dttPaidDate = new QDateTime($objSoapObject->PaidDate);
			if (property_exists($objSoapObject, 'FeeForUserFrom'))
				$objToReturn->intFeeForUserFrom = $objSoapObject->FeeForUserFrom;
			if (property_exists($objSoapObject, 'FeeForUserTo'))
				$objToReturn->intFeeForUserTo = $objSoapObject->FeeForUserTo;
			if (property_exists($objSoapObject, 'Status'))
				$objToReturn->intStatus = $objSoapObject->Status;
			if (property_exists($objSoapObject, 'SignForRelease'))
				$objToReturn->strSignForRelease = $objSoapObject->SignForRelease;
			if (property_exists($objSoapObject, 'TransactionId'))
				$objToReturn->intTransactionId = $objSoapObject->TransactionId;
			if (property_exists($objSoapObject, 'Type'))
				$objToReturn->intType = $objSoapObject->Type;
			if (property_exists($objSoapObject, '__blnRestored'))
				$objToReturn->__blnRestored = $objSoapObject->__blnRestored;
			return $objToReturn;
		}

		public static function GetSoapArrayFromArray($objArray) {
			if (!$objArray)
				return null;

			$objArrayToReturn = array();

			foreach ($objArray as $objObject)
				array_push($objArrayToReturn, TableEscrow::GetSoapObjectFromObject($objObject, true));

			return unserialize(serialize($objArrayToReturn));
		}

		public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) {
			if ($objObject->objUserIdFromObject)
				$objObject->objUserIdFromObject = TableUserProject::GetSoapObjectFromObject($objObject->objUserIdFromObject, false);
			else if (!$blnBindRelatedObjects)
				$objObject->intUserIdFrom = null;
			if ($objObject->objUserIdToObject)
				$objObject->objUserIdToObject = TableUserProject::GetSoapObjectFromObject($objObject->objUserIdToObject, false);
			else if (!$blnBindRelatedObjects)
				$objObject->intUserIdTo = null;
			if ($objObject->objProject)
				$objObject->objProject = TableProject::GetSoapObjectFromObject($objObject->objProject, false);
			else if (!$blnBindRelatedObjects)
				$objObject->intProjectId = null;
			if ($objObject->dttEscrowDate)
				$objObject->dttEscrowDate = $objObject->dttEscrowDate->__toString(QDateTime::FormatSoap);
			if ($objObject->dttCancelDate)
				$objObject->dttCancelDate = $objObject->dttCancelDate->__toString(QDateTime::FormatSoap);
			if ($objObject->dttPaidDate)
				$objObject->dttPaidDate = $objObject->dttPaidDate->__toString(QDateTime::FormatSoap);
			return $objObject;
		}




	}



	/////////////////////////////////////
	// ADDITIONAL CLASSES for QCubed QUERY
	/////////////////////////////////////

	class QQNodeTableEscrow extends QQNode {
		protected $strTableName = 'table_escrow';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'TableEscrow';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'UserIdFrom':
					return new QQNode('user_id_from', 'UserIdFrom', 'integer', $this);
				case 'UserIdFromObject':
					return new QQNodeTableUserProject('user_id_from', 'UserIdFromObject', 'integer', $this);
				case 'UserIdTo':
					return new QQNode('user_id_to', 'UserIdTo', 'integer', $this);
				case 'UserIdToObject':
					return new QQNodeTableUserProject('user_id_to', 'UserIdToObject', 'integer', $this);
				case 'ProjectId':
					return new QQNode('project_id', 'ProjectId', 'integer', $this);
				case 'Project':
					return new QQNodeTableProject('project_id', 'Project', 'integer', $this);
				case 'Amount':
					return new QQNode('amount', 'Amount', 'integer', $this);
				case 'Reason':
					return new QQNode('reason', 'Reason', 'string', $this);
				case 'EscrowDate':
					return new QQNode('escrow_date', 'EscrowDate', 'QDateTime', $this);
				case 'CancelDate':
					return new QQNode('cancel_date', 'CancelDate', 'QDateTime', $this);
				case 'PaidDate':
					return new QQNode('paid_date', 'PaidDate', 'QDateTime', $this);
				case 'FeeForUserFrom':
					return new QQNode('fee_for_user_from', 'FeeForUserFrom', 'integer', $this);
				case 'FeeForUserTo':
					return new QQNode('fee_for_user_to', 'FeeForUserTo', 'integer', $this);
				case 'Status':
					return new QQNode('status', 'Status', 'integer', $this);
				case 'SignForRelease':
					return new QQNode('sign_for_release', 'SignForRelease', 'string', $this);
				case 'TransactionId':
					return new QQNode('transaction_id', 'TransactionId', 'integer', $this);
				case 'Type':
					return new QQNode('type', 'Type', 'integer', $this);
				case 'TableTransactionAsEscrow':
					return new QQReverseReferenceNodeTableTransaction($this, 'tabletransactionasescrow', 'reverse_reference', 'escrow_id');

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

	class QQReverseReferenceNodeTableEscrow extends QQReverseReferenceNode {
		protected $strTableName = 'table_escrow';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'TableEscrow';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'UserIdFrom':
					return new QQNode('user_id_from', 'UserIdFrom', 'integer', $this);
				case 'UserIdFromObject':
					return new QQNodeTableUserProject('user_id_from', 'UserIdFromObject', 'integer', $this);
				case 'UserIdTo':
					return new QQNode('user_id_to', 'UserIdTo', 'integer', $this);
				case 'UserIdToObject':
					return new QQNodeTableUserProject('user_id_to', 'UserIdToObject', 'integer', $this);
				case 'ProjectId':
					return new QQNode('project_id', 'ProjectId', 'integer', $this);
				case 'Project':
					return new QQNodeTableProject('project_id', 'Project', 'integer', $this);
				case 'Amount':
					return new QQNode('amount', 'Amount', 'integer', $this);
				case 'Reason':
					return new QQNode('reason', 'Reason', 'string', $this);
				case 'EscrowDate':
					return new QQNode('escrow_date', 'EscrowDate', 'QDateTime', $this);
				case 'CancelDate':
					return new QQNode('cancel_date', 'CancelDate', 'QDateTime', $this);
				case 'PaidDate':
					return new QQNode('paid_date', 'PaidDate', 'QDateTime', $this);
				case 'FeeForUserFrom':
					return new QQNode('fee_for_user_from', 'FeeForUserFrom', 'integer', $this);
				case 'FeeForUserTo':
					return new QQNode('fee_for_user_to', 'FeeForUserTo', 'integer', $this);
				case 'Status':
					return new QQNode('status', 'Status', 'integer', $this);
				case 'SignForRelease':
					return new QQNode('sign_for_release', 'SignForRelease', 'string', $this);
				case 'TransactionId':
					return new QQNode('transaction_id', 'TransactionId', 'integer', $this);
				case 'Type':
					return new QQNode('type', 'Type', 'integer', $this);
				case 'TableTransactionAsEscrow':
					return new QQReverseReferenceNodeTableTransaction($this, 'tabletransactionasescrow', 'reverse_reference', 'escrow_id');

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

?>